/**
 * 
 */
package com.uobgroup.ews.uam.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.uobgroup.ews.uam.core.model.NotifyLoginResult;
import com.uobgroup.ews.uam.core.model.VerifyLoginResult;
import com.uobgroup.ews.uam.core.service.LoginAttemptService;

/**
 * @author phuongtran
 * 
 */

@RequestMapping("/loginservices")
@Controller
public class LoginAttemptController {

   @Autowired
   LoginAttemptService loginAttemptService;

   @RequestMapping(method = RequestMethod.GET, value = "/verifyloginallowed", headers = "Accept=application/json")
   public @ResponseBody
   VerifyLoginResult verifyLoginAllow(@RequestParam(value = "user", required = true) String user,
         @RequestParam(value = "workstation", required = false) String workStation) {
      return loginAttemptService.verifyLoginAllow(user, workStation);
   }
   
   @RequestMapping(method = RequestMethod.GET, value = "/notifyloginsuccess", headers = "Accept=application/json")
   public @ResponseBody
   NotifyLoginResult notifyLoginSuccess(@RequestParam(value = "user", required = true) String user,
         @RequestParam(value = "workstation", required = false) String workStation) {
      return loginAttemptService.notifyLoginSuccess(user, workStation);
   }
   
}














